home *** CD-ROM | disk | FTP | other *** search
/ Aminet 12 / Aminet 12 (1996)(GTI - Schatztruhe)[!][Jun 1996].iso / Aminet / dev / lang / HeliOS4.lha / helios_demo_disk4 / tutorials / Tutorial.doc < prev   
Encoding:
Text File  |  1995-11-10  |  66.5 KB  |  1,534 lines

  1.  
  2.     *************************** TUTORIAL ********************************
  3.  
  4.     This Tutorial is not intended as a substitute for careful reading of
  5.     the detailed program documentation, and merely talks you through a
  6.     few first steps.
  7.  
  8.     Here the aim is simply to accustom you to the HeliOS programming
  9.     environment and mention a few important and useful points which will
  10.     help you to get started.
  11.  
  12.     It is quite impossible to satisfy all requirements in an introduction
  13.     such as this, because HeliOS is aimed at programmers with a wide range
  14.     of expertise: some may be expert programmers and others may never have
  15.     tried programming before.  If you are in either of these categories,
  16.     or if you are coming to HeliOS from another very different language
  17.     like "C" or "Basic", please have patience and give this and the other
  18.     introductory tutorials a chance to explain some of the very unusual
  19.     features which make HeliOS possibly the most interesting and powerful
  20.     programming language for the Amiga.
  21.  
  22.     -------------------------------
  23.     Before you start reading.......
  24.     -------------------------------
  25.  
  26.     Before you commit yourself to reading this tutorial, you would probably
  27.     like to see HeliOS in action, so we have included a range of short demo
  28.     programs.
  29.  
  30.     These programs are very elementary in scope, but will give you some
  31.     useful source code upon which to build your first HeliOS programming
  32.     projects.  The idea is that these programs should provide you with
  33.     a few simple building blocks to help you get started.
  34.  
  35.     The demo source code files are in the HeliOS:Source directory, and
  36.     the file names all have a ".src" suffix for easy identification.
  37.  
  38.     These source code files are easy to run by proceeding as follows:
  39.  
  40.     If you press the "Intpt" button to get into the Interpreter, you will
  41.     find an Interpreter menu item "Compile file" in the "Compiling" menu.
  42.  
  43.     If you use this "Compile file" menu option, you will be presented with
  44.     a file requester using which you can select a source code file to run.
  45.  
  46.     Your selected file will be instantly interpreted, compiled and run.
  47.  
  48.     These source code files can also, of course, be loaded into one of the
  49.     HeliOS editors for inspection and modification, and can also be run
  50.     directly from the editor.
  51.  
  52.     Having seen these demos, please do read this and the other introductory
  53.     documentation before starting to do any HeliOS programming.
  54.  
  55.     -----------------------------------------
  56.     IMPORTANT: Setting your Amiga preferences
  57.     -----------------------------------------
  58.  
  59.     The HeliOS editor in which you are reading this text relies on certain
  60.     Amiga preferences settings.
  61.  
  62.     Even before going on to read this introductory tutorial it is a good
  63.     idea to ensure that your Amiga preferences are correctly adjusted.
  64.  
  65.     Failure to do this will probably mean that you will not get the best
  66.     performance from the ultra-fast HeliOS editor, and incorrectly set
  67.     Amiga preference settings can also be responsible for slowing down any
  68.     other text editors and word processors used on your system.
  69.  
  70.     There are two Amiga preferences settings which make a really dramatic
  71.     difference to the performance of the text editor: these are the mouse
  72.     button "double-click" timing interval and the keyboard repeat rate.
  73.  
  74.     It is a surprising fact that most people never trouble to change these
  75.     from the original Amiga default settings, and unfortunately the default
  76.     settings are far too slow.
  77.  
  78.     Programming involves much time spent editing text, and in general it
  79.     is important to be able to operate quickly and efficiently within your
  80.     editing environment.  The HeliOS editor is fast, and has many features
  81.     designed for quick operation via the mouse or keyboard: it is important
  82.     to make good use of this potential speed by choosing appropriate Amiga
  83.     preference settings.
  84.  
  85.     ------------------------------
  86.     The mouse double-click setting
  87.     ------------------------------
  88.  
  89.     If you tend to use the mouse frequently in your editing you soon become
  90.     fairly quick at mouse operations, and you do not really want two fast
  91.     but distinct mouse operations to be mistaken for a double-click.
  92.  
  93.     The left mouse double-click is used in the HeliOS editor to select text
  94.     block highlight mode, and obviously you do not want to enter this mode
  95.     by mistake when you are using the mouse to scroll or place the cursor.
  96.  
  97.     The standard Amiga double-click setting is so slow that if you do not
  98.     change it you will frequently select "highlight" mode by mistake in
  99.     the HeliOS editor: this is a frustrating and annoying experience!
  100.  
  101.     It is sensible to set the Amiga preferences double-click interval as
  102.     fast as is convenient, such that only quite fast double-clicks register
  103.     as such.  Please try this until you are happy with the double click
  104.     sensing within the HeliOS editor: if you get frequent occurrence of
  105.     unwanted text highlighting you will need to reduce the double-click
  106.     sensing interval.
  107.  
  108.     -------------------
  109.     The key repeat rate
  110.     -------------------
  111.  
  112.     The keyboard repeat speed has a tremendous influence on the speed and
  113.     responsiveness of any editor.  The HeliOS editor is one of the very
  114.     fastest on the Amiga, so what is the point of having all this speed if
  115.     your Amiga preferences are introducing a ridiculous delay between each
  116.     key operation?
  117.  
  118.     Again, the Amiga default keyboard repeat rate is terribly slow, and it
  119.     is vital to change this if you want to get full performance from the
  120.     fast HeliOS editors.
  121.  
  122.     Try holding down the left and right cursor keys and observe how fast
  123.     the cursor moves: adjust the key repeat rate until the cursor speed
  124.     is as fast as you can manage.  You will probably find that setting the
  125.     key repeat to maximum speed results in the best editor responsiveness.
  126.  
  127.  
  128.     ----------------
  129.     HeliOS and Forth
  130.     ----------------
  131.  
  132.     First we should explain that HeliOS is a Forth-like language with many
  133.     functions similar to that language.  Forth may be used as a model to
  134.     get started with HeliOS, but beware of carrying the analogy too far,
  135.     since HeliOS is radically different and more advanced in many respects.
  136.  
  137.     And it is actually easier, too......!
  138.  
  139.     Forth is sometimes (unjustly) thought to be difficult because it uses
  140.     a stack and "reverse polish notation", as does HeliOS, but you will
  141.     soon see that this system is very easy to learn and to use.
  142.  
  143.     In general fig-FORTH has been used as the model for most of the HeliOS
  144.     Forth-like functions, because this version of Forth has become the most
  145.     widely distributed and is more familiar to many people than the later
  146.     versions of the Forth standard.
  147.  
  148.     However, the fact is that there are more HeliOS functions which differ
  149.     from Forth than those which are similar, and the internal organisation
  150.     of HeliOS is totally different from Forth.
  151.  
  152.     If you want to study fig-Forth in one of the readily available texts,
  153.     by all means do so, but with care not to assume too much concurrence
  154.     between the two languages.  You will find a good deal of the general
  155.     program structure of Forth similar to HeliOS, and in particular you
  156.     will find the use of the stack in Forth very similar to HeliOS.
  157.  
  158.     ------------------------------
  159.     The Editor and the Interpreter
  160.     ------------------------------
  161.  
  162.     You are reading this in the HeliOS text editor, which is where
  163.     you spend most of the time when writing software.
  164.  
  165.     When you want to test and run the source code you have written,
  166.     you pass the code over to the Interpreter.
  167.  
  168.     The Interpreter has its own screen, where it handles all matters
  169.     relating to interpretation, debugging, and compiling.
  170.  
  171.     You will have seen already the Interpreter screen, and you can go
  172.     there any time to experiment with typing code at the command lines:
  173.     to do this just press the "Intpt" button.
  174.  
  175.     Note that you can cut and paste between the Interpreter command lines
  176.     and the editors, which can often be useful in testing short sections
  177.     of code.  You can also cut and paste freely between any of the HeliOS
  178.     editors, including the Out editor which "captures" all program output.
  179.  
  180.     To copy code from the editor to the command lines use the editor
  181.     "Copy" function, then move into the Interpreter and use the function
  182.     "Paste command lines" in the Interpreter "Copy/Paste" menu.
  183.  
  184.     To copy code from the Interpreter command lines to the editor use the
  185.     "Copy command lines" in the Interpreter "Copy/Paste" menu, then enter
  186.     the Editor and use "Paste".
  187.  
  188.     You can run code directly from within the editors, as you will see
  189.     later, but when you do so the HeliOS system will automatically move
  190.     you into the Interpreter.
  191.  
  192.     Have a look at the menu options and command buttons in the Editor
  193.     and Interpreter to see the sort of options available and the way
  194.     functional tasks are divided between the two environments.
  195.  
  196.     ------------------
  197.     The HeliOS Editors
  198.     ------------------
  199.  
  200.     Before giving you a short guided tour around the editors, let's
  201.     look at the easy method of getting started with HeliOS so that in
  202.     future you will be able to begin editing with the minimum of effort.
  203.  
  204.     ---------------------
  205.     Setting Startup Paths
  206.     ---------------------
  207.  
  208.     Very often you will be working on the same set of files from session
  209.     to session, or even the same file, so HeliOS allows you to preset the
  210.     paths in each of the editors to any particular files.  Having done so
  211.     you can start HeliOS and get to the file you require with just three
  212.     mouse clicks:
  213.  
  214.     To set the path for any editor, just load the file whose path you wish
  215.     to set, then use the "Save All Paths" option in the "Editing" menu.
  216.  
  217.     HeliOS will remember the path settings for the file requester in each
  218.     editor separately, as well as all other important path settings.
  219.  
  220.     Let us assume that you have this file in Editor1, and you now use the
  221.     "Save All Paths" menu option.
  222.  
  223.     Next time you start Helios, you will be presented initially with the
  224.     Interpreter screen as usual.
  225.  
  226.     To get back to this file:
  227.  
  228.     1.  Press the "Ed 1" button to enter "Editor 1".
  229.  
  230.     2.  Press the "Load File" button.  This is the red and white downward
  231.         pointing triangle button to the right of the filename string.
  232.  
  233.         This will bring up the file requester with the path and name of
  234.         your preset file already set.
  235.  
  236.     3.  Press the "Ok!" button in the file requester.
  237.  
  238.     Your preset file will be loaded without you typing anything and with
  239.     only three mouse clicks required.
  240.  
  241.     If you set each of the editors in this way it can save much time
  242.     compared with the usual method of using the file requester to navigate
  243.     to the same place at the start of every session.
  244.  
  245.     ---------------------
  246.     Using the Help System
  247.     ---------------------
  248.  
  249.     Rather than boring you by explaining the obvious here, you can use
  250.     the built in HeliOS "Help" function to familiarise yourself with the
  251.     general operation of all the buttons and menus.
  252.  
  253.     To enter "Help" mode, either press the "Help" key, press the "Help"
  254.     button, or use the "Help on user interface" menu option.
  255.  
  256.     Now, when you select any button or menu item, you will be presented
  257.     with a short explanatory text.
  258.  
  259.     To get "Help" on normally hidden control panels such as the colour
  260.     requester, the debugger, or the find/replace panel, you merely need
  261.     to activate the required panel before entering "Help" mode.
  262.  
  263.     Use the "Help" mode now to browse through the buttons and menus of
  264.     the HeliOS Editor (and the Interpreter too if you wish).
  265.  
  266.     Notice that some buttons do more than you might initially suppose,
  267.     and some have multi-functions, so look at all the options carefully.
  268.  
  269.     -------------------------------------
  270.     Special use of the Right Mouse Button
  271.     -------------------------------------
  272.  
  273.     In HeliOS the right mouse button is used for many purposes (such as
  274.     screen scrolling), and only acts in the usual Amiga "menu-selection"
  275.     mode when the mouse pointer is positioned over the title bar.
  276.  
  277.     If you have used the "Help" system to look around, you will perhaps
  278.     have noticed that the right mouse button can be used in many places
  279.     to gain quick access to commonly used commands as a "modifier" to
  280.     the left mouse button.
  281.  
  282.     Here are two very useful examples:
  283.  
  284.     1.  Holding down the right mouse button and double clicking the left
  285.         mouse button will put you instantly into columnar block mode.
  286.  
  287.         This is a very useful feature which enables you to cut and past
  288.         columns of text.
  289.  
  290.     2.  Holding down the right mouse button and clicking the left over
  291.         one of the "Ed x" buttons will compile the file in that editor.
  292.  
  293.     You can usually use the SHIFT or CTRL keys instead of the right mouse
  294.     button, but the right mouse method is quicker once you are used to it.
  295.  
  296.     It is worth looking several times through the "Help" system to pick
  297.     up operational details such as this concerning the main controls and
  298.     operations you intend to use often.
  299.  
  300.     ------------
  301.     HeliOS Menus
  302.     ------------
  303.  
  304.     The HeliOS menus all display command key sequences on the right of
  305.     the menu text.
  306.  
  307.     Notice that HeliOS menus allow unrestriced use of ANY command key
  308.     sequences, and also that all menu "Hot-keys" are user configurable,
  309.     along with the menu texts themselves.
  310.  
  311.     It is worth noting and learning the command key sequences for those
  312.     menu commands which you use often.
  313.  
  314.     ------------------------------------
  315.     Reconfiguring menus and command keys
  316.     ------------------------------------
  317.  
  318.     Because the HeliOS editor is easy to reconfigure, you may as well
  319.     learn how to do this as soon as possible so that you can set up the
  320.     software to suit your own preferences.
  321.  
  322.     All editing and menu command keys may be "rebound" in HeliOS, to allow
  323.     you to set up the HeliOS text editor to emulate any other editor to
  324.     which you are already accustomed.
  325.  
  326.     You can rebind single keys using the "Shortcut options" menu, but you
  327.     may prefer to edit the master ASCII key definition file.  This latter
  328.     option allows you to view and change ALL the key commands by editing a
  329.     simple text file.
  330.  
  331.     See the "InitialSetup.doc" file and other main documentation for full
  332.     instructions on how to do this.
  333.  
  334.     In addition you can create and save "Macros" which you can use to make
  335.     your own editing commands.
  336.  
  337.     Again, see the main documentation for details on Macros, but the basic
  338.     idea is that you record a series of commands and attach them to a single
  339.     keystroke.  This is a simple linear recording process very similar to
  340.     that used in many other word processors and text editors.
  341.  
  342.     Because the HeliOS system already uses a very large number of command
  343.     keys, it is important that you take care not to cause conflicting
  344.     allocations.  The process of rebinding keys and setting up macros is
  345.     easy in itself, but you do need to study existing allocations and plan
  346.     your new commands carefully.
  347.  
  348.     ------------------
  349.     Editing menu texts
  350.     ------------------
  351.  
  352.     Once you have changed any command keys you will notice that the menus
  353.     no longer describe the correct command sequences.  This is easy to put
  354.     right because all HeliOS menu texts can be changed by editing an ASCII
  355.     menu text definition file.
  356.  
  357.     In particular, you might wish to edit the "Key Index" menu page to
  358.     reflect any Macros which you have created and to display the commands
  359.     which you personally use most often.
  360.  
  361.     The "MenuText" configuration file is a simple ASCII file which can
  362.     be edited in any text editor and which contains its own instructions.
  363.  
  364.     See the "InitialSetup.doc" file for instructions on how to set up an
  365.     initial startup default "MenuText" file.  Remember that the default
  366.     startup file must be called "HeliOS_MenuText" and must be in the
  367.     same path as the KeyTable file.
  368.  
  369.     The most difficult time using any new software is at the beginning,
  370.     and the sooner you configure everything to suit your own taste, the
  371.     sooner you will be working productively.
  372.  
  373.     ----------------
  374.     The Options Menu
  375.     ----------------
  376.  
  377.     The "Options" menu is a place where you will find many useful settings
  378.     which you will probably want to experiment with early in your use of
  379.     the HeliOS editor.
  380.  
  381.     Here you can do things like setting the scroll speed to suit your own
  382.     Amiga system and choosing colours which you find pleasant.
  383.  
  384.     In particular we recommend that you experiment with the "Return" menu
  385.     options, since these can cause the editor to behave in a manner which
  386.     may be unfamiliar and confusing.  In fact most beginners initially
  387.     dislike the default "AutoIndent Return" setting, which is designed to
  388.     make life easier for programmers writing indented source code.  This
  389.     option behaves by default quite unlike the majority of word processors,
  390.     but can be reset to a more standard mode of operation if required.
  391.  
  392.     Try it both ways now and see what you think, but remember to try the
  393.     AutoIndent setting once you are writing source code since you will
  394.     then find it most useful.
  395.  
  396.     Most experienced programmers will find the default setting excellent
  397.     for editing indented source code but since no other Amiga editor
  398.     provides this facility you may need time to become accustomed to it.
  399.  
  400.     ------------------------
  401.     Saving the "Environment"
  402.     ------------------------
  403.  
  404.     Once you have set everything up to your requirements, do not forget
  405.     to use the "Save Environment" menu option in the "Editing" menu to
  406.     preserve your selected settings.
  407.  
  408.     ----------------------------------------
  409.     The "Status Display" and control buttons
  410.     ----------------------------------------
  411.  
  412.     Most of the status display at the top of the screen is fairly self
  413.     explanatory, but as mentioned above several of the control buttons
  414.     have dual functions.
  415.  
  416.     It is worth examining carefully the "Help" text on all these buttons
  417.     because they control all the most commonly used functions.
  418.  
  419.     In particular, do NOT use the "Editorx" button on the left of the
  420.     file name string gadget until you are very familar with the debugger,
  421.     since this will instantly enter "debug" mode with the current file.
  422.  
  423.     Using the debugger without expertise can be either very confusing
  424.     or downright disastrous, so please take care!
  425.  
  426.     The red and white triangle "Quick Load" button to the right of the
  427.     file name string gadget is very useful and worth remembering.
  428.  
  429.     The red and yellow triangle "Quick Save" button at the far right of
  430.     the editor status bar is very useful because it "lights up" to warn
  431.     you when any text has been changed in the editor.
  432.  
  433.     Pressing the "Quick Save" button when it is highlighted causes the
  434.     text in the editor to be saved with the current file name, and then
  435.     the "Quick Save" button reverts to its neutral colours.
  436.  
  437.     It is very useful to remember that pressing one of the "Ed x" buttons
  438.     with the left mouse button while simultaneously holding down SHIFT or
  439.     CTRL or R-MOUSE will cause the code in that editor to be instantly
  440.     compiled and test-run.  This is one of the most often used shortcuts,
  441.     so it is well worth remembering it from the start.
  442.  
  443.     ---------------------------------------------------------------
  444.     A useful little trick for the editor Find/Replace control panel
  445.     ---------------------------------------------------------------
  446.  
  447.     The <F1> key can be used to copy strings between the string requesters
  448.     in the Find/Replace control panel: this is worth remembering because it
  449.     can save much of the time taken to retype the word in slightly different
  450.     form.
  451.  
  452.     Pressing F1 when using the Search string gadget will copy the current
  453.     contents of the Search string gadget into the Replace string gadget and
  454.     then move the cursor down into the Replace string gadget.
  455.  
  456.     If the Replace string gadget is switched off (i.e. the Replace function
  457.     is currently disabled) using F1 in the Search string will fully activate
  458.     the Replace system before entering the Replace string gadget.
  459.  
  460.     Pressing F1 when using the Replace string gadget will copy the current
  461.     contents of the Replace string gadget into the Search string gadget,
  462.     while the cursor remains in the Replace string gadget.
  463.  
  464.  
  465.     -----------------------------------
  466.     More useful tricks for Find/Replace
  467.     -----------------------------------
  468.  
  469.     Please read the "Editor_Find&Replace.doc" file to learn about a few 
  470.     more very useful special features of the Find/Replace system......
  471.  
  472.  
  473.     -------------------------
  474.     Compiling HeliOS programs
  475.     -------------------------
  476.  
  477.     The most common circumstance, certainly while you are learning HeliOS,
  478.     is that you will be wanting to test and compile a program which you are
  479.     writing in one of the editors.
  480.  
  481.     Another common requirement is to test a small section or subroutine
  482.     which is just part of the program you are writing in an editor.
  483.  
  484.     Look at the small fragment of code below, and imagine that you had just
  485.     written it and wanted to test it.
  486.  
  487.     We are going to test this short routine in a moment, but first here are
  488.     four important things to check before trying to run ANY program.  They
  489.     may sound simple and even trivial, but casually running code without
  490.     knowing what you are doing can be a recipe for disaster.
  491.  
  492.     1. Know what the program is meant to do:
  493.  
  494.        * You should always know what a program SHOULD do before running it.
  495.  
  496.        This little program is intended to allow you to move a small red
  497.        circle around the screen, overwriting any existing screen graphics.
  498.  
  499.     2. Know how to quit the program:
  500.  
  501.        * Always beware of starting up programs which you cannot quit!
  502.  
  503.        You will need to press <Esc> to quit the drawing routine, upon
  504.        which the program will erase the red circles and rebuild the
  505.        HeliOS display.
  506.  
  507.     3. Know how the program is going to affect the HeliOS system:
  508.  
  509.        * Always be aware of what any program is going to do to the main
  510.          HeliOS environment - and save your work if there is any risk.
  511.  
  512.        When running any source code from an editor, HeliOS always moves
  513.        first to the interactive Interpreter display, then interprets the
  514.        source code passed from the editor.  Other than this, our little
  515.        program will not affect the main system.
  516.  
  517.     4. Know what system resources the program is going to change:
  518.  
  519.        * Always be aware of what any program is going to do to any part
  520.          of the Amiga's memory and operating sytem.
  521.  
  522.        Since the small "red circle" program uses the HeliOS default
  523.        graphic output, the program will only write to the HeliOS main
  524.        display area.  After this it will clear the HeliOS display.
  525.  
  526.  
  527.     Now you know what to expect, and you know how to get back to HeliOS by
  528.     pressing <Esc>, it is safe to try the program.
  529.  
  530.     Because it is just a short routine, you can run it by highlighting
  531.     the block of text and pressing <Left-Amiga-e>.  Alternatively you
  532.     could use the "Cut/Paste" menu option named "Compile marked block".
  533.  
  534.     Double click the left mouse button with the pointer on the blank line
  535.     immediately before the line containing the words "Clear the dictionary".
  536.  
  537.     This will start the highlighted area.
  538.  
  539.     Note that in HeliOS block highlight operations are defined entirely by
  540.     the reverse video display zone.
  541.  
  542.     This means that in HeliOS the highlighted area DOES NOT INCLUDE THE
  543.     CURSOR, so the single character under the cursor will NOT be included
  544.     in your highlighted block.
  545.  
  546.     Drag the mouse to past the program so that the highlighted area ends
  547.     on the blank line just after the line containing "Run new program".
  548.  
  549.     Hold down the Left Amiga key and press the "e" key.
  550.  
  551.     Try out the program, and remember to press the <Esc> key to quit.
  552.  
  553.     Highlight from the NEXT line below this one.
  554.  
  555.  
  556.     FORGET **CORE**                     \ Clear the dictionary
  557.  
  558.     : TUTORIAL1                         \ New program name
  559.  
  560.     FWINDOW -1 POINTER                  \ Switch off mouse pointer
  561.     1 REPORTMOUSE                       \ Switch on mouse position reports
  562.     1 GFXOUTLINE                        \ Enable graphic "outline" mode
  563.     1 GFXSETOPEN                        \ Set graphic outline pen to black
  564.     6 GFXSETAPEN                        \ Set foreground drawing pen to red
  565.  
  566.     BEGIN                               \ Start loop
  567.       GFXWAITTOF                        \ Wait for new frame
  568.       MOUSEX MOUSEY 8 4 GFXAREAELLIPSE  \ Draw red circle with black outline
  569.       GFXAREAEND                        \ Write area drawn to screen
  570.       ?TERMINAL 27 =                    \ Wait for <Esc>
  571.     UNTIL
  572.  
  573.     0 REPORTMOUSE                       \ Switch off mouse position reports
  574.     0 GFXOUTLINE                        \ Disable graphic "outline" mode
  575.  
  576.     FWINDOW 0 POINTER                   \ Switch on mouse pointer
  577.     SCRCLR                              \ Clear HeliOS text display
  578.     FSTATUS                             \ Redraw HeliOS display imagery
  579.     ;
  580.  
  581.     TUTORIAL1                           \ Run new program
  582.  
  583.     Remember: highlight to the line ABOVE this one, let go of the mouse
  584.     button, and then hold down the L-Amiga key while pressing the "e" key.
  585.  
  586.     Look at the comments in this little program and try changing a few
  587.     things.
  588.  
  589.     For example, try changing the following lines:
  590.  
  591.     6 GFXSETAPEN                        \ Set foreground drawing pen to red
  592.     ^
  593.     Change this number to alter the colour of the drawing circle.
  594.  
  595.       MOUSEX MOUSEY 8 4 GFXAREAELLIPSE  \ Draw red circle with black outline
  596.                     ^ ^
  597.                     Change these numbers to alter the circle/ellipse size.
  598.  
  599.     Recompile this small section of code a few times with different values,
  600.     just to see how things work.
  601.  
  602.     Running this little program illustrates how simple it is to test a
  603.     section of code from within the HeliOS editors.
  604.  
  605.     Notice that you are always placed in the interpreter when HeliOS is
  606.     running any code, and you need to press the "Ed x" button to get back
  607.     here to the editor.
  608.  
  609.     You may be interested at this point to know what happens if there is
  610.     an error when you are compiling either part or the whole of the source
  611.     code in any editor.
  612.  
  613.     If there is a mistake in your code, the line of text with the mistake
  614.     is displayed in the interpreter window, and a set of small arrows will
  615.     point to the error in the code line.
  616.  
  617.     Subsequently, when you return to the editor, you will automatically
  618.     be taken to the error line.
  619.  
  620.     Try compiling the line below now, by highlighting it, just as you did
  621.     the earlier code, and pressing "L-Amiga+e":
  622.  
  623.     By the way, make sure that the highlighted area starts BEFORE and goes
  624.     PAST the ends of the line: if you miss off the last ";" character the
  625.     compilation will fail.
  626.  
  627.     : MISTAKE SCRCLR 2 2 CURPUT ." Hi" 2 4 CURPUUT ." There!" WAITSPACE ;
  628.  
  629.     You can see that the mistyping of CURPUUT has been picked up by the
  630.     HeliOS interpreter, and note that wherever you may have been in the
  631.     editor you are always be brought back immediately to the error position.
  632.  
  633.     Now try highlighting the code line again and this time use the "Copy
  634.     block" function in the Cut/Paste menu to make a copy of the text.
  635.  
  636.     Now go into the interpreter and use the interpreter Cut/Paste menu
  637.     function to "Past command lines", so that the code line appears in
  638.     the interpreter command lines.
  639.  
  640.     Hit <Return> in the interpreter and you will, of course, find that the
  641.     code fails again.
  642.  
  643.     Press the "Cursor up arrow" key to retrieve the previous command line
  644.     and edit the faulty CURPUUT to the correct version: CURPUT.
  645.  
  646.     Now run the code again from the interpreter command lines.
  647.  
  648.     This time you should get an OK message.
  649.  
  650.     Notice that you keep getting a message telling you that MISTAKE has
  651.     multiple definitions.
  652.  
  653.     This is because MISTAKE does have multiple definitions - you guessed!
  654.  
  655.     Each time you try out a new version of a word, the old one remains in
  656.     the HeliOS dictionary, which can be useful - but we will not try to
  657.     explain this until you are a little more expert!
  658.  
  659.     If you keep recompiling small words like this, you keep consuming
  660.     tiny amounts of HeliOS dictionary space as each new definition is
  661.     compiled IN ADDITION TO the old ones.
  662.  
  663.     The "Dict" display in the top left corner of the Status Display always
  664.     shows you how much HeliOS dictionary space is available.
  665.  
  666.     Try compiling a few more versions of MISTAKE by pressing the "up arrow"
  667.     key, followed by <Return>, and as you do this observe how the "Dict"
  668.     display shows a reduced available Dictionary space.
  669.  
  670.     It really is a little untidy to keep making multiple copies of every
  671.     function as you experiment at the command line to improve your code,
  672.     so you will probably want to know how to remedy this.
  673.  
  674.     To clear definitions from the HeliOS dictionary you say FORGET followed
  675.     by the name of the word you want to forget.
  676.  
  677.     For example:
  678.  
  679.     FORGET MISTAKE
  680.  
  681.     would "forget" the latest copy of MISTAKE.
  682.  
  683.     There is one important thing to know about FORGET, and that is that it
  684.     forgets EVERY word compiled SINCE the target word as well as the target
  685.     word itself - so take care.
  686.  
  687.     Try compiling MISTAKE ten times, watching the dictionary free space
  688.     display go down.
  689.  
  690.     Now use FORGET MISTAKE ten times and watch the dictionary free space
  691.     go back up again.
  692.  
  693.     Usually, in fact, we want to clear all user words to give us a "clean"
  694.     system, and in this case you use the expression FORGET **CORE**.
  695.  
  696.     Try using FORGET **CORE** now to clear the system down to the CORE
  697.     vocabulary.
  698.  
  699.     In general you need not use FORGET after every recompilation from the
  700.     command lines, and the occasional use of FORGET **CORE** is all that
  701.     is required to keep the dictionary clear.
  702.  
  703.     Never worry about the messages concerning "multiple definitions" since
  704.     this is only a warning and there are no serious detrimental effects.
  705.  
  706.     When you are compiling programs from an editor, it is best to put the
  707.     line FORGET **CORE** at the start of all your programs.  If you do this
  708.     the system will always be cleared each time you recompile.
  709.  
  710.     Notice that the first line of our "Red Circle" program was:
  711.  
  712.     FORGET **CORE**                     \ Clear the dictionary
  713.  
  714.     Now, finally, go back to the interpeter and recompile the correct
  715.     version of MISTAKE.
  716.  
  717.     The interpeter said OK, but nothing happened otherwise.
  718.  
  719.     You simply compiled the word MISTAKE, which effectively now is a new
  720.     word within the HeliOS vocabulary.
  721.  
  722.     Use the menu option to list the vocabulary and you will see that you
  723.     have indeed created a new command called MISTAKE.
  724.  
  725.     You have not yet, however, run the small program contained in the
  726.     definition of MISTAKE.
  727.  
  728.     To run MISTAKE, you now only need type MISTAKE in the command lines
  729.     and press <Return>.
  730.  
  731.     Try it now.
  732.  
  733.     All that you have done above will illustrate to you the simple way
  734.     that HeliOS works by adding new commands to the language.  In fact,
  735.     HeliOS programming consists always in this process of extending the
  736.     language.
  737.  
  738.     As you may imagine, it is not long before you start to build up a
  739.     new repertoire of commands which YOU have created.  The advantage
  740.     of HeliOS programming is that all these new commands which you create
  741.     have three absolutely wonderful characteristics:
  742.  
  743.     1.  You wrote them yourself to do a job which you required, so you
  744.         have built a new tool which is very useful to you for ever more.
  745.  
  746.     2.  Because you wrote them yourself, you understand them thoroughly.
  747.  
  748.     3.  You will have given them NAMES which YOU find appropriate, so you
  749.         will find them easy to remember and your code will be very readable
  750.         to you since it uses your own function names.
  751.  
  752.     Think about it for a moment, and you will see that programming in
  753.     HeliOS is like building your very own language, so how could it not be
  754.     absolutely ideal for your own purposes!
  755.  
  756.     After a while you will have built a HeliOS system "in your own image"
  757.     and you will be able to do far more with it than if you were confined
  758.     to the straight-jacket of someone else's strict programming system.
  759.  
  760.     You can even simply change HeliOS word names which you do not like.
  761.  
  762.     Let us suppose that you can never remember a certain word name, for
  763.     example "WBENCHTOFRONT".  Let us suppose that you are really sick of
  764.     mistyping this stupid long word, and you want to change its name to
  765.     "WBF".
  766.  
  767.     All you need do is use the following line:
  768.  
  769.     : WBF WBENCHTOFRONT ;
  770.  
  771.     You will now have redefined a new name for WBENCHTOFRONT.
  772.  
  773.     Try it, and try typing WBF.
  774.  
  775.     Look in the vocabulary and there you have it: WBF!
  776.  
  777.     So you can appreciate that once you have moulded HeliOS to fit your own
  778.     ideas and mode of expression, it will be a powerful and personal tool.
  779.  
  780.  
  781.     --------------------------
  782.     Status and debug reporting
  783.     --------------------------
  784.  
  785.     Notice that when a program finishes the HeliOS system reports the
  786.     state of the stack etc. into the main window.  In fact you normally
  787.     get full information about program execution time and how long the
  788.     program took to execute, as well as a stack readout.  This information
  789.     can be switched off, but it is normally quite useful to retain it.
  790.  
  791.     How many other languages give you this information automatically?
  792.  
  793.     In fact, the reason that the HeliOS display switches to the Interpreter
  794.     screen while running a program is so that you can view any text messages
  795.     output while the program is running and when it completes.
  796.  
  797.     By default all such text messages go to the main Interpreter screen.
  798.  
  799.     One of the most commonly used, and best, debugging methods is to make
  800.     your program output debug messages while it is running.  Simple text
  801.     messages and stack reports can tell you where your program is going
  802.     wrong, and often this will be all you need to debug even complex
  803.     programs.
  804.  
  805.     Of course, it can be very annoying if messages output by a program
  806.     scroll off the screen before you can read them!  Everyone has suffered
  807.     this at one time or another, and if your program is outputting debug
  808.     messages to the HeliOS screen while running a different display you
  809.     might never even SEE the messages of course.
  810.  
  811.     Some systems get around this problem by using a second computer and
  812.     a serial port link as a "debug console", but this is hardly convenient
  813.     for all circumstances.
  814.  
  815.     HeliOS has a very nice way of getting around the problem, and it does
  816.     so by using an editable output review buffer.
  817.  
  818.     By default (although this option is switchable) all text output to the
  819.     main Interpreter window also is output into one of the Editors.  This
  820.     "Output Buffer" editor is called simply the "Out" editor, and is exactly
  821.     the same as the other three editors except that it receives a full copy
  822.     of the Output text stream from the Interpreter.
  823.  
  824.     You can see the "Out" button at the top of the screen, and you will
  825.     notice that it has a small red "highlight".  This highlight indicates
  826.     that the option for Interpreter output to be preserved in the "Out"
  827.     editor is currently "On".
  828.  
  829.     You can switch off this feature from the Interpreter menus if you wish,
  830.     upon which the highlight will be switched off and the "Out" editor can
  831.     be used as a normal editor.
  832.  
  833.     Not only can you switch off this feature and use the "Out" editor as a
  834.     normal editor; you can also:
  835.  
  836.     * Set the size of the output buffer,
  837.     * Clear the output buffer,
  838.     * Switch on/off session log markers which identify each output
  839.     * Switch on/off separator lines between outputs
  840.  
  841.     These latter two options allow you to divide up the output text into
  842.     sections which you can easily relate to individual output sessions.
  843.     Even program execution times and stack returns are recorded, so that
  844.     the "Out" editor becomes a full session log and debug report facility.
  845.  
  846.     Since you can freely edit, print, save, cut and paste the "Out" editor,
  847.     you can use it to do many useful things, such as generating programmed
  848.     text tables etc. This is a another very powerful unique HeliOS feature.
  849.  
  850.     Above all though, it is useful to be able to retain debug and error
  851.     reports, and we recommend that you leave this feature enabled unless
  852.     you really need to use four editors simultaneously.
  853.  
  854.     Look in the "Out" editor now and you will see the full report of your
  855.     earlier sessions, recorded even complete with the time you did things.
  856.  
  857.     ------------------------------
  858.     Running complete program files
  859.     ------------------------------
  860.  
  861.     Running a program which consists of a complete text file is actually
  862.     even easier than running a highlighted subsection of code.
  863.  
  864.     All you need to do is load the program file into an editor, for example
  865.     "Ed 1", then press the "Ed 1" button at the top of the screen while
  866.     holding down the right mouse button (or the CTRL or SHIFT key).
  867.  
  868.     The HeliOS system will once again switch to the Interpreter screen and
  869.     run the program.
  870.  
  871.     If you look in the Key Index menu you will see that there is a command
  872.     key for compiling the current editor: this is CTRL+"5".
  873.  
  874.     -----------------------------
  875.     Experimenting at the keyboard
  876.     -----------------------------
  877.  
  878.     HeliOS is an easy language to learn at the keyboard and there is no
  879.     real substitute for creative experimentation. Once you have discovered
  880.     how simple it is to open screens and windows, and to output graphics
  881.     and text within an easily comprehensible system, your efforts can soon
  882.     be directed to really creative programming.
  883.  
  884.     The source code files supplied with HeliOS have been included to give
  885.     you a starting point for your own efforts.  All you have to do is load
  886.     up any of the supplied source code and take from it the sections which
  887.     interest you.
  888.  
  889.     You can very easily elaborate on these simple demonstration programs,
  890.     and at the same time have all the basic support routines already strung
  891.     together for you.  This saves you the tedium of looking up new words at
  892.     every turn when you are still learning.
  893.  
  894.     HeliOS code can be entered on the lines at the bottom of the Interpreter
  895.     screen and then, by pressing return, transmitted directly to the HeliOS
  896.     interpreter. The up and down cursor keys can be used to recover previous
  897.     input for modification and retrial if required, which makes the system
  898.     very comfortable for quick keyboard experimentation.
  899.  
  900.     For longer and more advanced sections of HeliOS code you can perhaps
  901.     more easily experiment by entering your code in an editor and compiling
  902.     it from there, either as a complete file or a marked block.
  903.  
  904.     Remember always to save your code to disk before compiling it, just in
  905.     case the program crashes.
  906.  
  907.     The format of your code is quite unrestricted, and it really is a matter
  908.     of personal taste how you wish to lay things out.
  909.  
  910.     Notice that source code comments can be entered in several ways. Long
  911.     sections of commentary can be entered using the word "(" as follows:
  912.  
  913.     ( ................ Commentary ........................................
  914.      ................................... Commentary...................... )
  915.  
  916.     The interpreter will skip all material between the two round brackets.
  917.  
  918.     Remember that the first round bracket must, like all HeliOS words, have
  919.     a space before it and a space after it. The second round bracket still
  920.     needs a preceding and succeeding space, even though it is merely a
  921.     delimiter.
  922.  
  923.     There is also provision for skipping commentary material up to the end of
  924.     each line by using the word "\" as follows:
  925.  
  926.     HELIOSWORD ..... HELIOSWORD  \ This is a comment and will be skipped.
  927.  
  928.     The interpreter will skip the material after "\", up to the end of the
  929.     line, and then restart interpretation at the beginning of the next line.
  930.  
  931.     ----------------------------
  932.     Controlling editor scrolling
  933.     ----------------------------
  934.  
  935.     If you use the cursor "Up" and "Down" arrow keys to scroll the editor
  936.     text display, scrolling speed is deliberately quite slow for ease of
  937.     reading text "on the fly".
  938.  
  939.     It is worth noting that you can momentarily increase the scrolling speed
  940.     at any time by pressing one of the shift keys while still pressing the
  941.     arrow key.  You can speed up and slow down scrolling at will by simply
  942.     holding down the cursor arrow key and pressing and releasing a shift key.
  943.  
  944.     Try it!
  945.  
  946.     ----------------
  947.     PAUSE convention
  948.     ----------------
  949.  
  950.     In HeliOS a convention has been adopted when dealing with continous
  951.     scrolling displays which it may be useful to know from the start.
  952.  
  953.     It is very frustrating when scrolling displays go scrolling off the
  954.     screen before you can read them.  If you try to examine the HeliOS
  955.     CORE vocabulary for example, you will find that it rapidly scrolls
  956.     through many screens of text.
  957.  
  958.     Any operation which may require to be paused, such as listing the
  959.     vocabulary to the screen, or DUMPing memory contents, will always in
  960.     HeliOS include a standard PAUSE function.
  961.  
  962.     This PAUSE function works as follows :
  963.  
  964.     <SPACE> = Pauses operation.
  965.     <SPACE> = Restarts after Pause.
  966.     <ESC>   = Quits operation, and can be used while paused or not.
  967.  
  968.     -----------------------------
  969.     Requester response convention
  970.     -----------------------------
  971.  
  972.     Another convention is that when a HeliOS requester appears at the top
  973.     of the display requiring a "positive" or "negative" response, such
  974.     as a "Proceed/Cancel" request, it may be answered from the keyboard
  975.     using the "y" and "n" keys.
  976.  
  977.     "y" = Positive respose (Yes)
  978.     "n" = Negative respose (No)
  979.  
  980.  
  981.     -------------------------
  982.     Text, Windows and Streams
  983.     -------------------------
  984.  
  985.     HeliOS uses an interesting and powerful text stream system which can
  986.     save you a great deal of programming effort.
  987.  
  988.     It is worth mentioning this here to introduce you to what is a quite
  989.     unfamiliar concept on the Amiga.
  990.  
  991.     All normal output passes via the standard HeliOS text output routines
  992.     which use an enhanced application of the Amiga console device and
  993.     transmit screen output via a system of ten HeliOS text streams.
  994.  
  995.     You can set up a comprehensive HeliOS console text output system for
  996.     any window by simply using the one word MAKEOUTWINDOW, and in a similar
  997.     way you can set up a sophisticated user input gathering system by using
  998.     MAKEINWINDOW.
  999.  
  1000.     These two single word functions are equivalent to many pages of rather
  1001.     complex code in many other languages.  If you are a "C" programmer, try
  1002.     considering how much code you would need to write to achieve the full
  1003.     functionality of the HeliOS STREAM system we are about to describe.
  1004.  
  1005.     HeliOS is full of such labour saving devices, which is why it can be
  1006.     considered an ideal beginner's language as well as being probably the
  1007.     most powerful language on the Amiga.  You CAN have the best of both
  1008.     worlds, and power is not always synonymous with tedious complexity.
  1009.  
  1010.     HeliOS console text output is always associated with one of the ten
  1011.     streams, and the current stream can be set by using the single word
  1012.     STREAM, preceded by a number from 0 to 9.
  1013.  
  1014.     Before we even start to explain streams, try the little program below
  1015.     which outputs the HeliOS vocabulary list to a small text window: if
  1016.     you do not wish to wait for the whole listing to scroll by just press
  1017.     <Esc> to quit.
  1018.  
  1019.     6 STREAM 20 10 40 10 SCRWIN 1 BPENSET 6 FPENSET VLIST 2 STREAM SCRCLR
  1020.  
  1021.     or, with better layout and comments:
  1022.  
  1023.     6 STREAM               \ Enter stream 6
  1024.     20 10 40 10 SCRWIN     \ Set stream 6 text window
  1025.                            \ Top corner = Column 20 Row 10
  1026.                            \ Width      = 40 Columns
  1027.                            \ Height     = 10 Rows
  1028.     1 BPENSET              \ Set background pen to 1 (=Black)
  1029.     6 FPENSET              \ Set foreground pen to 6 (=Red)
  1030.     VLIST                  \ Output any demo text (list the vocabulary)
  1031.     2 STREAM               \ Return to interpreter output window stream
  1032.     SCRCLR                 \ Clear the mess we have made!
  1033.  
  1034.  
  1035.     This creates a new text window as STREAM 6, outputs text to it, then
  1036.     returns to STREAM 2 and clears the interpeter (STREAM 2) display.
  1037.  
  1038.     You now have STREAM 6 set up in terms of colours, window size, and
  1039.     position, so you can try something like:
  1040.  
  1041.     6 STREAM SCRCLR ." Hello!" WAITSPACE 2 STREAM SCRCLR
  1042.  
  1043.     Try it.
  1044.  
  1045.     It really is that easy to set up text streams!  No other language has
  1046.     anything like this facility, so once again HeliOS gives you a labour
  1047.     saving edge over other Amiga languages.
  1048.  
  1049.     Try highlighting and running the short program below, from the line
  1050.     after this one to the line after the word STREAMTEST.
  1051.  
  1052.     : STREAMTEST
  1053.  
  1054.     2 STREAM  SCRCLR
  1055.     6 STREAM 20  8 20 10 SCRWIN 1 BPENSET 6 FPENSET
  1056.     7 STREAM 45 12 20 10 SCRWIN 7 BPENSET 1 FPENSET
  1057.     8 STREAM 70 16  5 10  SCRWIN 3 BPENSET 4 FPENSET
  1058.     100 0
  1059.     DO
  1060.       6 STREAM ." Hello There!"
  1061.       7 STREAM ." Hello There!"
  1062.       8 STREAM ." Hello There!"
  1063.     LOOP
  1064.     2 STREAM
  1065.     4 20 CURPUT ." Press <Space> or <L-Mouse> to continue."
  1066.     WAITSPACE
  1067.     ;
  1068.  
  1069.     STREAMTEST
  1070.  
  1071.  
  1072.     Highlight to the line above this one.
  1073.  
  1074.     As you can see, text output via HeliOS streams is simple to program
  1075.     and very powerful.
  1076.  
  1077.     Here is a very brief overview of streams:
  1078.  
  1079.     Having set a stream, you can set up a text window, with unique text
  1080.     styles and colours, and that stream will retain these settings.  You
  1081.     can set up several streams and move between them using the STREAM
  1082.     command, instantly recalling the preset stream characteristics of each
  1083.     stream.
  1084.  
  1085.     These text windows are actually subsections of a console text display
  1086.     and are not in any way related conceptually to Intuition windows.  An
  1087.     Intuition window is the background entity to which a console text
  1088.     output display may be connected, but the HeliOS stream window is merely
  1089.     a further subdivision of the console text display area.
  1090.  
  1091.     Any text formatting carried out while using any particular stream is
  1092.     automatically remembered when the stream is left, and restored when
  1093.     that stream is re-entered.
  1094.  
  1095.     Output in any stream can be formatted using a word called SCRWIN to
  1096.     set up a restricted independent "scrolling text window" area of the
  1097.     screen into which output is channelled.  You can use SCRCLR to clear
  1098.     any stream window.
  1099.  
  1100.     Setting a new stream text window causes the cursor position to be forced
  1101.     to the top left corner of the window.  All output is then confined within
  1102.     the text window limits and automatic scrolling takes place.
  1103.  
  1104.     There is also a word SETCONORIGIN which allows precise pixel-placement
  1105.     of text stream window boundaries.  You can have several stream windows
  1106.     within a single "console device" window, each with a different pixel
  1107.     alignment with respect to each other and the main "parent" window.
  1108.  
  1109.     A wide range of text styles and colours can be set by the user and will
  1110.     be automatically associated with the current STREAM and remembered.
  1111.  
  1112.     In general, the idea of STREAMS is that many features of a text window
  1113.     are associated with the current stream, and are automatically preserved
  1114.     as you move from one stream to another.  This enables you to completely
  1115.     define many different output formats and change between them instantly
  1116.     merely by use of the single word STREAM.
  1117.  
  1118.     ------------------------------------------
  1119.     A few interesting features of text streams
  1120.     ------------------------------------------
  1121.  
  1122.     The HeliOS display uses some streams itself, and in cases where your
  1123.     program uses streams it is best to call a function named INITFSTREAMS
  1124.     when your program finishes, to reinitialise the HeliOS stream system.
  1125.  
  1126.     Rows and columns within text windows in HeliOS are numbered from 1
  1127.     upwards i.e. the top left corner is 1,1.
  1128.  
  1129.     Text stream output can be simultaneously directed, using PRTON/PRTOFF,
  1130.     to a printer via the AmigaDOS PRT: device.
  1131.  
  1132.     Text stream output can also be sent to any "capture" file if the file
  1133.     handle is placed in the variable ALTOUT.
  1134.  
  1135.     See the definitions of FILEON, FILEOFF, OPENALT, CLOSEALT, and ALTERNATE
  1136.     in the "Dictionary.doc" file.
  1137.  
  1138.     There are many commands related to HeliOS text output, and in particular
  1139.     things like cursor control and automatic collection of user input are
  1140.     well worth investigating early in your HeliOS programming efforts.
  1141.  
  1142.     Please do take the time to read the dictionary file to get more details
  1143.     about console output/input and general text handling.
  1144.  
  1145.     You will find that HeliOS has no rival on the Amiga in terms of its
  1146.     text handling ability, and also has the most comprehensive array of
  1147.     text string handling words.
  1148.  
  1149.     We hope that you are already happy that HeliOS has been an excellent
  1150.     investment for you, in terms of the care and attention which has gone
  1151.     into making this a truly excellent Amiga programming system.  If you
  1152.     like the small things you have seen so far, just think that you have
  1153.     over 1000 special HeliOS functions at your disposal, and probably the
  1154.     most advanced arcade game programming subsystem available on any home
  1155.     computer.
  1156.  
  1157.     While we are on this short guided tour, let us look at some more unique
  1158.     HeliOS features which distinguish it from other programming languages.
  1159.  
  1160.     -----------------
  1161.     Resource tracking
  1162.     -----------------
  1163.  
  1164.     On a flexible and multi-tasking computer such as the Amiga, many of
  1165.     your programming tasks relate to the requesting of available resources
  1166.     from the operating system, and the restoring of these resources when you
  1167.     have finished with them.
  1168.  
  1169.     If you are just learning to program the Amiga, you may find that good
  1170.     intentions in this direction sometimes fail, and you will not always
  1171.     succeed in closing down a faulty program, for example, with all its
  1172.     resources restored to the Amiga operating system.  You may end up with
  1173.     memory allocated by a program and not restored correctly, windows not
  1174.     closed, and all manner of other discrepancies.
  1175.  
  1176.     HeliOS can help you if this happens, because unlike any other Amiga
  1177.     language it has a comprehensive built in resource management system.
  1178.     HeliOS maintains internal lists detailing everything that has been
  1179.     allocated and opened using HeliOS commands.  If you close down HeliOS
  1180.     the HeliOS system will automatically do a comprehensive clean up of any
  1181.     allocations which you may have missed, restoring the Amiga operating
  1182.     system to what it was when HeliOS started up.
  1183.  
  1184.     If you find that your early efforts have messed things up a little, all
  1185.     you need do is close down HeliOS and then start again.  HeliOS will
  1186.     clear everything up for you (unless you did serious damage!) and you
  1187.     can start again without rebooting.
  1188.  
  1189.     You could actually use this comprehensive resource tracking system to
  1190.     be totally lazy, allowing HeliOS to do all your clearing up for you,
  1191.     but this is, needless to say, not a good idea.  Nevertheless, if you
  1192.     are writing some experimental code which you want to test quickly, and
  1193.     you haven't time to write all the close down routines properly, you can
  1194.     at least use the HeliOS resource manager as a temporary aid.
  1195.  
  1196.  
  1197.     ----------------------
  1198.     Command line "History"
  1199.     ----------------------
  1200.  
  1201.     The Intepreter command lines have a "History" feature which allows you
  1202.     to recall previous input for modification.
  1203.  
  1204.     The good news is that actually this is a feature of the HeliOS built-in
  1205.     line editor, and so it is available for use in all your own programs.
  1206.  
  1207.     The command line editor will not duplicate remembered input sessions,
  1208.     so if you make the same input five times, only one will be remembered.
  1209.  
  1210.     This "History" feature is very useful indeed when you are, for example,
  1211.     learning to use the stack by entering small sections of code at the
  1212.     interpreter command line.
  1213.  
  1214.  
  1215.     -------------
  1216.     Stack Display
  1217.     -------------
  1218.  
  1219.     Which brings us to the stack display at the top of the interpeter
  1220.     window.  This is a permanent feature of the interpeter display unless
  1221.     you are using the debugger, and it has been provided entirely for the
  1222.     benefit of anyone who is learning to use a stack oriented language like
  1223.     HeliOS for the first time.
  1224.  
  1225.     No other language goes to the trouble of providing such a useful feature
  1226.     just to help beginners, and we hope you will find it useful in getting
  1227.     used to the sometimes initially confusing concept of the HeliOS stack.
  1228.  
  1229.     The idea here is that you can play with stack operators at the command
  1230.     line while observing the program output on the main screen display and
  1231.     with a full display of the current state of the stack always present
  1232.     in the stack display area.
  1233.  
  1234.     Use the stack display to get a thorough understanding of how the stack
  1235.     is affected by various commands.  This is a unique feature of HeliOS,
  1236.     and is really worth exploiting while you are still learning to become
  1237.     familiar with parameter passing via the stack.
  1238.  
  1239.     You will find more about the stack in the tutorials......
  1240.  
  1241.  
  1242.     -------------
  1243.     Documentation
  1244.     -------------
  1245.  
  1246.     There are many documentation files with HeliOS, and it is important to
  1247.     be able to access this information and have a knowledge of where to find
  1248.     particular topics.
  1249.  
  1250.     Here is a quick overview.
  1251.  
  1252.     The most important document of all is the "Dictionary.doc", which is a
  1253.     comprehensive reference file for all the words in the HeliOS language.
  1254.  
  1255.     Next in initial importance are the tutorial files, which will lead you
  1256.     through many aspects of HeliOS programming.
  1257.  
  1258.     Much important information has been included in these tutorial files
  1259.     rather than being packed away in obscure reference documents.
  1260.  
  1261.     The tutorial files present many vital topics in a sequential easy to
  1262.     follow manner, with many examples.  It is absolutely essential for a
  1263.     full understanding of HeliOS that you read ALL the tutorials, because
  1264.     much of the information contained in them is not only very important,
  1265.     but is not given elsewhere.
  1266.  
  1267.     While you are still unfamiliar with HeliOS you will probably find the
  1268.     documents in the UserInterface document directory useful, since they
  1269.     explain details of the general HeliOS operating environment which the
  1270.     on-line help does not cover.
  1271.  
  1272.     The rest of the documentation contains descriptive files, with examples,
  1273.     of all other aspects of the HeliOS language, such as the special HeliOS
  1274.     function libraries, and the game operating system.
  1275.  
  1276.     In the documentation on the HeliOS game operating system you will find
  1277.     much useful information on important general Amiga computing topics such
  1278.     as generating Amiga displays and using hardware sprites.
  1279.  
  1280.  
  1281.     -------------------------------------------
  1282.     The further note on the Dictionary.doc file
  1283.     -------------------------------------------
  1284.  
  1285.     As you will have seen, HeliOS has many individual documentation files
  1286.     covering different aspects of the HeliOS system, but the majority of
  1287.     the main documentation on all the command words is contained in the one
  1288.     large "master" dictionary file.
  1289.  
  1290.     The "Dictionary.doc" is the essential main reference source for all the
  1291.     fundamental HeliOS language functions, and you may find it useful to
  1292.     keep this file in one of the editors for constant easy access.
  1293.  
  1294.     If you are running short of memory you may find that the dictionary file
  1295.     is too large for convenient use, and in extreme cases may even be unable
  1296.     to load it at all.  In these cases you may need to divide the dictionary
  1297.     file into shorter more manageable sections, and it is easy to do this in
  1298.     the HeliOS editor using the "Load part" menu option.  This option allows
  1299.     you to load a short section of any file, and if necessary you can save
  1300.     files back out in short sections.
  1301.  
  1302.     As you write, and gradually expand, your first short HeliOS programs we
  1303.     recommend that you spend a little time each day reading the dictionary
  1304.     to learn more about how the commands you are using work.
  1305.  
  1306.     If you read the dictionary carefully, and learn new commands one at a
  1307.     time while simultaneously trying them out in interesting small programs,
  1308.     you will, in no time at all, have a confident command of the all most
  1309.     important HeliOS functions.
  1310.  
  1311.     The dictionary is a vital source of important information on how HeliOS
  1312.     works, and since the dictionary file is ordered in sections relating to
  1313.     functionally connected words you may find it useful to read more about
  1314.     command words related to the ones you already know.  For example, you
  1315.     will soon know the words CURPUT and CURGET, but having gained confidence
  1316.     using these you should make a point of looking at all the other cursor
  1317.     functions too, in order to expand your repertoire of commands.
  1318.  
  1319.     When you are learning a new set of command words it is a good idea to
  1320.     experiment at the keyboard using the interpreter and to write example
  1321.     programs to get a "hands on" feel for how everything works.
  1322.  
  1323.  
  1324.     -----------------------------------------------------------
  1325.     A useful thing to learn early - the HeliOS macro key system
  1326.     -----------------------------------------------------------
  1327.  
  1328.     Making full use of the powerful features of the HeliOS user interface
  1329.     will help speed up your initial learning, and one of the most useful
  1330.     of these features is the HeliOS command macro system.
  1331.  
  1332.     Rather than go into full detail here we refer you to the file:
  1333.  
  1334.     HeliOS:Docs/UserInterface/HeliOS_Macro_Commands.Doc
  1335.  
  1336.     Please read this file once you get down to programming, because by
  1337.     using the command macros you can set up HeliOS to do many useful
  1338.     things, especially setting up your own custom help system.
  1339.  
  1340.  
  1341.     -------------------
  1342.     Where to go now....
  1343.     -------------------
  1344.  
  1345.     HeliOS is a very large and flexible system, and the way you use it is
  1346.     down to your own personal preference.
  1347.  
  1348.     Please do not omit to look at the documentation on the user interface
  1349.     and general program functions, because otherwise you may well miss many
  1350.     powerful features of the software which are not immediately obvious.
  1351.  
  1352.     When it comes to learning HeliOS programming, do not try to learn too
  1353.     much "theoretically" by reading documentation on all the hundreds of
  1354.     HeliOS commands BEFORE you start programming.  You will never learn
  1355.     everything this way and HeliOS has too many program commands to learn
  1356.     by simply reading about them in advance.
  1357.  
  1358.     Having advised you not to read TOO much programming documentation to
  1359.     start with, you will nevertheless find it useful to gradually work
  1360.     through all the HeliOS Language Tutorials.  The tutorials will give
  1361.     you some insight into the basic concepts of HeliOS programming, and
  1362.     offer a good gradual introduction to much essential HeliOS "technical"
  1363.     knowledge.
  1364.  
  1365.     HeliOS has been designed to be "interactive" and to allow creative and
  1366.     direct experimentation.  In spite of the advice given in many books
  1367.     on programming (whose authors have evidently never used or seen a good
  1368.     interactive computer language) do not be afraid to experiment "at the
  1369.     keyboard" and follow up your own ideas.
  1370.  
  1371.     Above all, try doing things which interest you, and try doing things
  1372.     you own way.  HeliOS provides an extremely "rich" set of commands in
  1373.     order to allow a wide choice of programming techniques.  There is no
  1374.     "right and wrong" way to do things (although you will find certain
  1375.     techniques more efficent than others), and you will always find that
  1376.     examining your own programs will reveal ways of improving them.  If
  1377.     you learn to do the simple things really well the large scale programs
  1378.     will come easily.
  1379.  
  1380.     You can best approach your first programming efforts by working with
  1381.     the example programs provided, and as you do so you can look up words
  1382.     which you do not understand in the HeliOS dictionary documentation.
  1383.  
  1384.     Use the example programs provided as a starting point for your own
  1385.     experiments and get used to how things work by changing the programs
  1386.     a little at a time to see what happens.
  1387.  
  1388.     As you start to write your own programs you will learn new commands and
  1389.     find which techniques suit you best: then you will gradually make use
  1390.     of more of the advanced features of HeliOS as you progress.
  1391.  
  1392.     Each time you look up a function in the dictionary documentation it is
  1393.     a good idea to read a little more about associated functions.  This will
  1394.     gradually increase your knowledge of useful new HeliOS words, and you
  1395.     will often be surprised to discover powerful functions which help you
  1396.     to produce more effective programs.
  1397.  
  1398.  
  1399.     ------------------------------
  1400.     A useful philosophical outlook
  1401.     ------------------------------
  1402.  
  1403.     The way you approach the large task of learning to program the Amiga
  1404.     will determine your success or failure.
  1405.  
  1406.     Most beginners quite rightly, and admirably, have a good idea of what
  1407.     they want to be able to do, and naturally they want to know "how to do
  1408.     it" quickly, assuming there is a relatively simple "know how" involved.
  1409.  
  1410.     The basic assumption is that the experts know something which enables
  1411.     them to program the Amiga, like some kind of magic technique which
  1412.     will surely be found by reading some book or other........
  1413.  
  1414.     This is not how it is when you are programming the Amiga, and to
  1415.     avoid instant disillusionment here are a few things you might consider.
  1416.  
  1417.     Do not try to go to fast and do not become disillusioned when you
  1418.     realise that programming the Amiga is not going to be easy.....
  1419.  
  1420.     The Amiga is a complex computer and many apparantly easy things take
  1421.     quite a lot of background programming: there simply are not too many
  1422.     instant tricks to do clever things, and the reality is that hard work
  1423.     and time are required before you write masterpieces.
  1424.  
  1425.     All the wonderful fluent and exciting software you see and wish to
  1426.     emulate has been created by very experienced programmers who have had
  1427.     to learn the basics first just like everyone else.  There are no real
  1428.     shortcuts, although HeliOS does try to give you as many fine automated
  1429.     tools as possible, and to make programming as enjoyable as possible.
  1430.  
  1431.     Do not start by trying to realise your "dream projects": before you
  1432.     try to do creative things it is best (necessary!) to concentrate on
  1433.     becoming fluent in the techniques and tools which will underpin all
  1434.     your future efforts.
  1435.  
  1436.     Like climbing a hill, it is better to keep your head down and take each
  1437.     small step carefully.  In fact, if you think about it, it is obvious
  1438.     that your dream program will never get written unless and until you
  1439.     personally have taken all the basic apparantly dull and insignificant
  1440.     steps which will be required to write it.
  1441.  
  1442.     You will not find your future masterpiece in any book written by someone
  1443.     else, and no amount of reading other people's ideas and reading other
  1444.     people's code will ever teach you as much as hands on experience down
  1445.     in the "engine room", learning by experience.  Do not waste too much
  1446.     time searching for that illusive book or file which will answer all
  1447.     your questions: it probably does not exist.
  1448.  
  1449.     Most beginner's spend more time trying fruitlessly to find "instant
  1450.     solutions" from other sources than they do actually learning to program.
  1451.     It may not be obvious, and it may not be too exciting, but the reality
  1452.     is that the most useful way to learn to program is to do-it-yourself:
  1453.     write your own small programs and learn fundamentals "at the keyboard".
  1454.  
  1455.     Do not expect to be told, or to read, "how to write an arcade game",
  1456.     as if there were only one way: you might indeed get hints and ideas
  1457.     from other people's code, but you will always do best to work things
  1458.     out for yourself when it comes to creating your final code.
  1459.  
  1460.     Above all, experiment and play with the computer: enjoy yourself
  1461.     trying out new ideas and doing things in new ways.  If you do not
  1462.     enjoy your programming you will have a long struggle.....and HeliOS
  1463.     is designed for creative programming and enjoyment.
  1464.  
  1465.  
  1466.     ----------------------------------------
  1467.     A starting point for your first programs
  1468.     ----------------------------------------
  1469.  
  1470.     The file "Tutorial.src" will give you a simple starting point and
  1471.     provides a useful start-up and close-down framework for launching
  1472.     your own first programs.
  1473.  
  1474.     Once you are bored with reading tutorials you might like to try
  1475.     loading this short program into one of the editors and experimenting.
  1476.  
  1477.     To run the Tutorial.src program once you have loaded it into an editor
  1478.     simply hold down SHIFT or CTRL or R-MOUSE while pressing the "Ed x"
  1479.     button of the editor containing the program - or use the menu option.
  1480.  
  1481.     Try experimenting with this program until you really feel confident
  1482.     that you understand it: this simple code can be a good basis for all
  1483.     your early HeliOS programs.
  1484.  
  1485.  
  1486.     -------------
  1487.     Configuration
  1488.     -------------
  1489.  
  1490.     Having become familiar with HeliOS please do not forget to read the
  1491.     "InitialSetup.doc" file, which will give you an insight into useful
  1492.     ways of reconfiguring the software to suit your own needs.
  1493.  
  1494.  
  1495.     -------------------
  1496.     Helios User Support
  1497.     -------------------
  1498.  
  1499.     We hope that you like using HeliOS and that you communicate your ideas
  1500.     to other HeliOS programmers by joining the HeliOS user group.
  1501.  
  1502.     Helios Software are also willing to help you directly with any problems
  1503.     you are experiencing, and for this reason we operate an advisory scheme
  1504.     whereby for a small charge we offer you help with any general HeliOS
  1505.     programming difficulty.
  1506.  
  1507.  
  1508.     ------------
  1509.     A final word
  1510.     ------------
  1511.  
  1512.     Thank you for purchasing HeliOS, and we hope that you will support
  1513.     our continued development of this excellent language by persuading
  1514.     your friends to pay the very reasonable purchase price rather than
  1515.     using a copied version.
  1516.  
  1517.     HeliOS is constantly evolving, and legitimate registered users will
  1518.     have the advantage of gaining a constant and regular stream of exciting
  1519.     new functions to use.
  1520.  
  1521.     It really is worthwhile for any HeliOS programmer to be a registered
  1522.     user, even if only to get the latest software updates, so please do
  1523.     support our efforts by discouraging piracy.
  1524.  
  1525.     We would be pleased to hear your views on new features you would like
  1526.     to see in HeliOS, as well as improvements you think would benefit other
  1527.     programmers.
  1528.  
  1529.     We hope that you enjoy using this quality Helios product.
  1530.  
  1531.     Thank you.
  1532.  
  1533.     Helios Software
  1534.